new_window_obj.document.body....
<iframe name="iframe_a"></iframe> <p><a href="https://cs.tru.ca/~mlee/comp3540" target="iframe_a">COMP 3540</a></p>
$('[name="iframe_a"]').on('load', function() {
...
});
$('[name="iframe_a"]').on('load', function() {
alert(this.contentWindow.document.body.innerHTML);
alert(this.contentDocument.getElementById('test').innerHTML);
alert(this.contentWindow.test_variable); // test_variable is a varible in a script loading in the iframe.
});
/* in iframe-exercise1.php,
<?php
echo "<p id='p-iframe-exercise1'>Received command = " . $_GET['command'] . "</p>";
echo "<script> var result = '" . "The received command is " . $_GET['command'] . "';</script>";
?>
*/
<form target='name-iframe-mainpage' method=... action=...>...</form>
<iframe name=??? style='display:none'></iframe>
$('#id-iframe-mainpage').on('load', function() {
var data = this.contentWindow.data_sent_from_server; // data_sent_from_server is a variable that holds hard coded data.
// This data might be an object.
// How can PHP code send a JS object? As a string?
// We will discuss about this later again.
var table = ... // using the above data
$('#id-result-pane-mainpage').html(table);
});
iframe_obj.contentWindow.document.write('<p>Hmmmmm</p>'); iframe_obj.contentWindow.close();
alert(iframe_obj.contentWindow.data_sent_from_server);